//
//  ChapterInfo.m
//  SpaceStorm
//
//  Created by 祥 雍 on 13-5-26.
//  Copyright (c) 2013年 __MyCompanyName__. All rights reserved.
//
//  章节格子关联表的信息类

#import "ChapterInfo.h"
#import "Variable.h"

@implementation ChapterInfo

@synthesize gridId = _gridId;
@synthesize chapter = _chapter;
@synthesize serialNumber = _serialNumber;
@synthesize isFirst = _isFirst;
@synthesize isBoss = _isBoss;
@synthesize branch1 = _branch1;
@synthesize branch2 = _branch2;
@synthesize branch3 = _branch3;
@synthesize branch4 = _branch4;
@synthesize explorationNumber = _explorationNumber;


+(id) infoWithTbxml:(TBXMLElement *)tbxml
{
    return [[[self alloc] initWithTbxml:tbxml] autorelease]; 
}

-(id) initWithTbxml:(TBXMLElement *)tbxml
{
    self = [super init]; 
	
	if (self!= nil) 
    {
        //格子id
        self.gridId = [[TBXML valueOfAttributeNamed:@"gridId" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"格子id:%d", self.gridId);
        
        //章节	
        self.chapter = [[TBXML valueOfAttributeNamed:@"chapter" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"章节:%d", self.chapter);
        
        //编号	
        self.serialNumber = [[TBXML valueOfAttributeNamed:@"serialNumber" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"编号:%d", self.serialNumber);
        
        //是否首格？	
        self.isFirst = [[TBXML valueOfAttributeNamed:@"isFirst" forElement:tbxml] boolValue];
        if(showXMLLog == YES) CCLOG(@"是否首:%i", self.isFirst);
        
        //BOSS战？	
        self.isBoss = [[TBXML valueOfAttributeNamed:@"isBoss" forElement:tbxml] boolValue];
        if(showXMLLog == YES) CCLOG(@"BOSS战:%i", self.isBoss);
        
        //分支1	
        self.branch1 = [[TBXML valueOfAttributeNamed:@"branch1" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"分支1:%d", self.branch1);
        
        //分支2	
        self.branch2 = [[TBXML valueOfAttributeNamed:@"branch2" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"分支2:%d", self.branch2);
        
        //分支3
        self.branch3 = [[TBXML valueOfAttributeNamed:@"branch3" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"分支3:%d", self.branch3);
        
        //分支4	
        self.branch4 = [[TBXML valueOfAttributeNamed:@"branch4" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"分支4:%d", self.branch4);
        
        //探索次数
        self.explorationNumber = [[TBXML valueOfAttributeNamed:@"explorationNumber" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"探索次数:%d", self.explorationNumber);
    }
    
    return self;
}

@end
